#ifndef _dal_h
#define _dal_h

#include "wx/wx.h"
#include "mysql.h"



enum ResultType{
	sets,
	affectedrows,
	error
};


struct MySQLError{
	unsigned int err_no;
	char* errmsg;
};

struct QueryResult{
	char** result;
	int row;
	int col;
	ResultType type;
	unsigned int error_no;
	unsigned int affected_rows;
	char* msg;
	QueryResult* next;
};

/*struct QueryResults{
	QueryResult res;
	struct QueryResults* next;
};*/

struct QueryResultList{
	struct QueryResult* head;
	int length;
};


/*typedef MySQLError ConnectResult;*/

//extern "C" {

extern MYSQL* InitMySQL(MYSQL* mysql);
extern void CloseMySQL(MYSQL* mysql);
extern MYSQL* ConnectToMySQL(MYSQL* mysql,const char* host,const char* user,const char* passwd,const char* db,unsigned int port);
extern QueryResultList* DoQuery(MYSQL* mysql,const char* query);
extern QueryResult* GetExecuteQueryInfo(MYSQL* mysql,QueryResult* r);
extern void FreeQueryResultList(QueryResultList* res);
extern void FreeQueryResult(QueryResult* r);
extern QueryResultList* DoQuery(MYSQL* mysql,const char* query,QueryResultList* list,QueryResult* cur,QueryResult* r);
//}

#endif